// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
let login = '/login';
let info = '/userInfo'
let articleslist = '/article/getList'
let articlesnewlist = '/article/getnewList'
let showarticle = '/article/showarticle'
let addcomment = '/article/addcomment'
let getcollect = "/collect/getList"
let addcollect = "/collect/inscollect"
let delcollect = "/collect/delcollect"
let getcomlist = "/comment/getcomlist"
let delcom = "/comment/delcom"
let getvcode = "/Register_vcode"
let register = "/Register"
let updatetime = "/updatetime"
let updata_Uname = "updata_Nname"
let updata_Pwd = "/updata_Pwd"
let checktype = "/article/checktype"
let getvcodeP = "/update_vcode"
let checkkey = "/article/checkkey"
let getListbyauthor = "/article/getListbyauthor"
let apply_author = "/Apply_author"
let checktime = "/checktime"
// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此处使用了传入的params参数，一切自定义即可
	let postlogin = (params) => vm.$u.post(login, params)
	let postinfo = (token) => vm.$u.post(info, {}, {
		token
	})
	let postarticleslist = (params) => vm.$u.post(articleslist, params)
	let postarticlesnewlist = (params) => vm.$u.post(articlesnewlist, params)
	let postshowarticle = (params) => vm.$u.post(showarticle, params)
	let postaddcomment = (params, token) => vm.$u.post(addcomment, params, {
		token
	})
	let postgetcollect = (params) => vm.$u.post(getcollect, params)
	let postaddcollect = (params) => vm.$u.post(addcollect, params)
	let postdelcollect = (params) => vm.$u.post(delcollect, params)
	let postgetcomlist = (params) => vm.$u.post(getcomlist, params)
	let postdelcom = (params) => vm.$u.post(delcom, params)
	let postgetvcode = (params) => vm.$u.post(getvcode, params)
	let postregister = (params) => vm.$u.post(register, params)
	let postupdatetime = (params) => vm.$u.post(updatetime, params)
	let postupdateUname = (params) => vm.$u.post(updata_Uname, params)
	let postupdata_Pwd = (params) => vm.$u.post(updata_Pwd, params)
	let postchecktype = (params) => vm.$u.post(checktype, params)
	let postgetvcodeP = (params) => vm.$u.post(getvcodeP, params)
	let postcheckkey = (params) => vm.$u.post(checkkey, params)
	let postgetListbyauthor = (params) => vm.$u.post(getListbyauthor, params)
	let postapply_author = (params) => vm.$u.post(apply_author, params)
	let postchecktime= (params) => vm.$u.post(checktime, params)
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		postlogin,
		postinfo,
		postarticleslist,
		postarticlesnewlist,
		postshowarticle,
		postaddcomment,
		postgetcollect,
		postaddcollect,
		postdelcollect,
		postgetcomlist,
		postdelcom,
		postgetvcode,
		postregister,
		postupdatetime,
		postupdateUname,
		postupdata_Pwd,
		postchecktype,
		postgetvcodeP,
		postcheckkey,
		postgetListbyauthor,
		postapply_author,
		postchecktime,
	};
}

export default {
	install
}
